package moon.core.genericity;

import java.util.ArrayList;
import java.util.List;

import moon.core.Name;
import moon.core.classdef.ClassDef;
import moon.core.classdef.MethDec;
import moon.core.classdef.Type;

/**
 * Formal parameter with or without bounds (subtyped).
 * 
 * @author <a href="mailto:rmartico@ubu.es">Ra&uacute;l Marticorena</a>
 *
 */
@SuppressWarnings("serial")
public abstract class BoundS extends FormalPar {
	
	/**
	 * Bounds.
	 */
	private List<Type> bounds;
	
	/**
	 * Constructor.
	 * 
	 * @param name name of the formal par
	 */
	public BoundS(Name name) {
		super(name);
		bounds = new ArrayList<Type>();
	}
	
	/**
	 * Constructor.
	 * 
	 * @param name name of the formal par
	 * @param classDef class where the formal par appears
	 */
	public BoundS(Name name, ClassDef classDef) {
		super(name, classDef);
		bounds = new ArrayList<Type>();
	}
	
	/**
	 * Constructor.
	 * 
	 * @param name name of the formal par
	 * @param methDec method where the formal par appears
	 */
	public BoundS(Name name, MethDec methDec) {
		super(name, methDec);
		bounds = new ArrayList<Type>();
	}
	
	/**
	 * Adds a type bound.
	 * 
	 * @param classType type bound
	 */
	public void add(Type classType){		
		bounds.add(classType);
	}
	
	/**
	 * Gets all the type bounds.
	 * 
	 * @return type bounds
	 */
	public List<Type> getBounds(){
		return bounds;
	}
	
} // BoundS
